Skip to contentSkip to conversation

Change in openvpn[master]: Use openssl_err_t typedef to deal with difference between TLS libraries

Openvpn-devel In review plaisthos (Code Review) 2 participants 6 messages Mar 17 – Mar 22 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): gerrit.1773754326000.I4adbdf0c8b82fd7de309aa5f6f3b0c8157c5ffe7@...2715...

#1 lore raw

plaisthos has uploaded this change for review. ( http://gerrit.openvpn.net/c/openvpn/+/1578?usp=email )

Change subject: Use openssl_err_t typedef to deal with difference between TLS libraries
......................................................................

Use openssl_err_t typedef to deal with difference between TLS libraries

AWS-LC and OpenSSL disagree on the type of that errors are reported in.

Instead of having a lot of glue code and casting back and forth, use a typedef to always use the right type.

Change-Id I4adbdf0c8b82fd7de309aa5f6f3b0c8157c5ffe7

---
M src/openvpn/crypto_openssl.c
M src/openvpn/openssl_compat.h

2 files changed, 12 insertions(+), 3 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/78/1578/1

src/openvpn/crypto_openssl.c +1 -1
index 19cb9a9..9900d06 100644
@@ -229,7 +229,7 @@
 void
 crypto_print_openssl_errors(const unsigned int flags)
 {
-    unsigned long err = 0;
+    openssl_err_t err = 0;
     int line, errflags;
     const char *file, *data, *func;
 
src/openvpn/openssl_compat.h +11 -2
index ab011d3..8fdb39a 100644
@@ -45,6 +45,15 @@
 #include <openssl/x509.h>
 #include <openssl/err.h>
 
+/* Define the type of error. This is something that is less
+ * intrusive than casts everywhere */
+#if defined(OPENSSL_IS_AWSLC)
+typedef uint32_t openssl_err_t;
+#else
+typedef unsigned long openssl_err_t;
+#endif
+
+
 /* Functionality missing in 1.1.0 */
 #if OPENSSL_VERSION_NUMBER < 0x10101000L && !defined(ENABLE_CRYPTO_WOLFSSL)
 #define SSL_CTX_set1_groups SSL_CTX_set1_curves
@@ -157,12 +166,12 @@
     /* OpenSSL 1.1.1 and lower use only const EVP_MD, nothing to free */
 }
 
-static inline unsigned long
+static inline openssl_err_t
 ERR_get_error_all(const char **file, int *line, const char **func, const char **data, int *flags)
 {
     static const char *empty = "";
     *func = empty;
-    unsigned long err = ERR_get_error_line_data(file, line, data, flags);
+    openssl_err_t err = ERR_get_error_line_data(file, line, data, flags);
     return err;
 }
 

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1578?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I4adbdf0c8b82fd7de309aa5f6f3b0c8157c5ffe7
Gerrit-Change-Number: 1578
Gerrit-PatchSet: 1
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>

#2 lore raw
In reply to a message not in the archive

Attention is currently required from: plaisthos.

flichtenheld has posted comments on this change by plaisthos. ( http://gerrit.openvpn.net/c/openvpn/+/1578?usp=email )

Change subject: Use openssl_err_t typedef to deal with difference between TLS libraries
......................................................................

Patch Set 1: Code-Review+2

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1578?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I4adbdf0c8b82fd7de309aa5f6f3b0c8157c5ffe7
Gerrit-Change-Number: 1578
Gerrit-PatchSet: 1
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Comment-Date: Tue, 17 Mar 2026 13:42:13 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes

#3 lore raw

PATCH 1/1 Use openssl_err_t typedef to deal with difference between TLS libraries

In reply to a message not in the archive

From: Arne Schwabe <[email protected]...>

AWS-LC and OpenSSL disagree on the type of that errors are reported in.

Instead of having a lot of glue code and casting back and forth, use a typedef to always use the right type.

Change-Id I4adbdf0c8b82fd7de309aa5f6f3b0c8157c5ffe7

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1578
---

This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1578
This mail reflects revision 1 of this Change.

Acked-by according to Gerrit (reflected above):
Frank Lichtenheld <[email protected]...>

src/openvpn/crypto_openssl.c +1 -1
index 19cb9a9..9900d06 100644
@@ -229,7 +229,7 @@
 void
 crypto_print_openssl_errors(const unsigned int flags)
 {
-    unsigned long err = 0;
+    openssl_err_t err = 0;
     int line, errflags;
     const char *file, *data, *func;
 
src/openvpn/openssl_compat.h +11 -2
index ab011d3..8fdb39a 100644
@@ -45,6 +45,15 @@
 #include <openssl/x509.h>
 #include <openssl/err.h>
 
+/* Define the type of error. This is something that is less
+ * intrusive than casts everywhere */
+#if defined(OPENSSL_IS_AWSLC)
+typedef uint32_t openssl_err_t;
+#else
+typedef unsigned long openssl_err_t;
+#endif
+
+
 /* Functionality missing in 1.1.0 */
 #if OPENSSL_VERSION_NUMBER < 0x10101000L && !defined(ENABLE_CRYPTO_WOLFSSL)
 #define SSL_CTX_set1_groups SSL_CTX_set1_curves
@@ -157,12 +166,12 @@
     /* OpenSSL 1.1.1 and lower use only const EVP_MD, nothing to free */
 }
 
-static inline unsigned long
+static inline openssl_err_t
 ERR_get_error_all(const char **file, int *line, const char **func, const char **data, int *flags)
 {
     static const char *empty = "";
     *func = empty;
-    unsigned long err = ERR_get_error_line_data(file, line, data, flags);
+    openssl_err_t err = ERR_get_error_line_data(file, line, data, flags);
     return err;
 }
 
#4 lore raw

[Openvpn-devel] [PATCH applied] Re: Use openssl_err_t typedef to deal with difference between TLS libraries

Looks reasonable, has ACK from Frank, and is so localized that it makes sense to include this in 2.7 - "long term compatibility" things.

Lightly tested the 2.7 change on an linux/openssl build.

Your patch has been applied to the master and release/2.7 branch.

commit ee2af6655d1dae8b87d8128e2afeec4f5506d79b (master) commit ca6c9a8886918ae85fe3295a920eace480aa3971 (release/2.7)

Author: Arne Schwabe
Date:   Sun Mar 22 12:11:15 2026 +0100
     Use openssl_err_t typedef to deal with difference between TLS libraries

     Signed-off-by: Arne Schwabe <[email protected]...>
     Acked-by: Frank Lichtenheld <[email protected]...>
     Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1578
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg36242.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#5 lore raw
In reply to a message not in the archive

cron2 has uploaded a new patch set (#2) to the change originally created by plaisthos. ( http://gerrit.openvpn.net/c/openvpn/+/1578?usp=email )

The following approvals got outdated and were removed:
Code-Review+2 by flichtenheld

Change subject: Use openssl_err_t typedef to deal with difference between TLS libraries
......................................................................

Use openssl_err_t typedef to deal with difference between TLS libraries

AWS-LC and OpenSSL disagree on the type of that errors are reported in.

Instead of having a lot of glue code and casting back and forth, use a typedef to always use the right type.

Change-Id I4adbdf0c8b82fd7de309aa5f6f3b0c8157c5ffe7

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1578
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg36242.html

---
M src/openvpn/crypto_openssl.c
M src/openvpn/openssl_compat.h

2 files changed, 12 insertions(+), 3 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/78/1578/2

src/openvpn/crypto_openssl.c +1 -1
index 19cb9a9..9900d06 100644
@@ -229,7 +229,7 @@
 void
 crypto_print_openssl_errors(const unsigned int flags)
 {
-    unsigned long err = 0;
+    openssl_err_t err = 0;
     int line, errflags;
     const char *file, *data, *func;
 
src/openvpn/openssl_compat.h +11 -2
index ab011d3..8fdb39a 100644
@@ -45,6 +45,15 @@
 #include <openssl/x509.h>
 #include <openssl/err.h>
 
+/* Define the type of error. This is something that is less
+ * intrusive than casts everywhere */
+#if defined(OPENSSL_IS_AWSLC)
+typedef uint32_t openssl_err_t;
+#else
+typedef unsigned long openssl_err_t;
+#endif
+
+
 /* Functionality missing in 1.1.0 */
 #if OPENSSL_VERSION_NUMBER < 0x10101000L && !defined(ENABLE_CRYPTO_WOLFSSL)
 #define SSL_CTX_set1_groups SSL_CTX_set1_curves
@@ -157,12 +166,12 @@
     /* OpenSSL 1.1.1 and lower use only const EVP_MD, nothing to free */
 }
 
-static inline unsigned long
+static inline openssl_err_t
 ERR_get_error_all(const char **file, int *line, const char **func, const char **data, int *flags)
 {
     static const char *empty = "";
     *func = empty;
-    unsigned long err = ERR_get_error_line_data(file, line, data, flags);
+    openssl_err_t err = ERR_get_error_line_data(file, line, data, flags);
     return err;
 }
 

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1578?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I4adbdf0c8b82fd7de309aa5f6f3b0c8157c5ffe7
Gerrit-Change-Number: 1578
Gerrit-PatchSet: 2
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>

#6 lore raw
In reply to a message not in the archive

cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1578?usp=email )

Change subject: Use openssl_err_t typedef to deal with difference between TLS libraries
......................................................................

Use openssl_err_t typedef to deal with difference between TLS libraries

AWS-LC and OpenSSL disagree on the type of that errors are reported in.

Instead of having a lot of glue code and casting back and forth, use a typedef to always use the right type.

Change-Id I4adbdf0c8b82fd7de309aa5f6f3b0c8157c5ffe7

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1578
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg36242.html

---
M src/openvpn/crypto_openssl.c
M src/openvpn/openssl_compat.h

2 files changed, 12 insertions(+), 3 deletions(-)
src/openvpn/crypto_openssl.c +1 -1
index 19cb9a9..9900d06 100644
@@ -229,7 +229,7 @@
 void
 crypto_print_openssl_errors(const unsigned int flags)
 {
-    unsigned long err = 0;
+    openssl_err_t err = 0;
     int line, errflags;
     const char *file, *data, *func;
 
src/openvpn/openssl_compat.h +11 -2
index ab011d3..8fdb39a 100644
@@ -45,6 +45,15 @@
 #include <openssl/x509.h>
 #include <openssl/err.h>
 
+/* Define the type of error. This is something that is less
+ * intrusive than casts everywhere */
+#if defined(OPENSSL_IS_AWSLC)
+typedef uint32_t openssl_err_t;
+#else
+typedef unsigned long openssl_err_t;
+#endif
+
+
 /* Functionality missing in 1.1.0 */
 #if OPENSSL_VERSION_NUMBER < 0x10101000L && !defined(ENABLE_CRYPTO_WOLFSSL)
 #define SSL_CTX_set1_groups SSL_CTX_set1_curves
@@ -157,12 +166,12 @@
     /* OpenSSL 1.1.1 and lower use only const EVP_MD, nothing to free */
 }
 
-static inline unsigned long
+static inline openssl_err_t
 ERR_get_error_all(const char **file, int *line, const char **func, const char **data, int *flags)
 {
     static const char *empty = "";
     *func = empty;
-    unsigned long err = ERR_get_error_line_data(file, line, data, flags);
+    openssl_err_t err = ERR_get_error_line_data(file, line, data, flags);
     return err;
 }
 

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1578?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I4adbdf0c8b82fd7de309aa5f6f3b0c8157c5ffe7
Gerrit-Change-Number: 1578
Gerrit-PatchSet: 2
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>